button: Center images
authorMatthias Clasen <mclasen@redhat.com>
Mon, 15 Jun 2020 16:23:32 +0000 (12:23 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 15 Jun 2020 16:24:48 +0000 (12:24 -0400)
If we leave the valign to be the default fill, then
the images pick up baseline alignment from the environment,
which can occasionally lead to misplaced -/+ icons in
spinbuttons, for example in the "Page Setup" tab of
the print dialog.

gtk/gtkbutton.c

index dc96c752b18d253f1bfdef7f9d845754d6a786cb..425bac06757eb9c8ef55d9a5740debda95c18688 100644 (file)
@@ -973,6 +973,7 @@ gtk_button_set_icon_name (GtkButton  *button,
     {
       GtkWidget *child = gtk_image_new_from_icon_name (icon_name);
       gtk_button_set_child (GTK_BUTTON (button), child);
+      gtk_widget_set_valign (child, GTK_ALIGN_CENTER);
       gtk_widget_remove_css_class (GTK_WIDGET (button), "text-button");
       gtk_widget_add_css_class (GTK_WIDGET (button), "image-button");
     }